from fastapi import Request


def getUserInfo(request: Request, key :str = None):
    if key == None:
        return request.scope["token_data"]["id"]
    else:
        return request.scope["token_data"][key]